home *** CD-ROM | disk | FTP | other *** search
/ MacFormat España 20 / macformat_20.iso / mac / Shareware / Desarrolladores / Sprite Animation Toolkit 2.3.8 / Add-ons / Lib ƒ / SATAddOnLib.h < prev    next >
Text File  |  1995-11-09  |  5KB  |  108 lines

  1. /*SATAddOnLib is a lib of the "Add-ons" that are easily put in a library (i.e. the ones without*/
  2. /*a "stubs" file). They include:*/
  3.  
  4. /*GammaFade*/
  5. /*ProgressBar*/
  6. /*FaceFromPict*/
  7. /*SATToolbox*/
  8. /*Preferences*/
  9. /*Pixels*/
  10.  
  11.  
  12. /**** GammaFade ****/
  13. /*Screen fading routines.*/
  14.  
  15. pascal void FadeToBlack(long ticks);
  16. pascal void FadeFromBlack(long ticks);
  17. pascal FacePtr GetFaceFromPICT(short colorPICTid,short bwPICTid,short maskPICTid);
  18.  
  19. /* Pixel array types and routines */
  20.  typedef struct Pixel {
  21.     Point position;
  22.     char data1, data2, data3, data4;
  23.    } Pixel, Pixels, *PixelPtr;
  24.  
  25.  pascal void SATDrawPixels (PixelPtr pix, SATPort *port, long value);
  26.  pascal void SATCopyPixels (PixelPtr pix, SATPort *src, SATPort *dest);
  27.  pascal void SATDrawPixelsSafe (PixelPtr pix, SATPort *port, long value);
  28.  pascal void SATCopyPixelsSafe (PixelPtr pix, SATPort *src, SATPort *dest);
  29.  
  30. /* Preference file handling */
  31.  
  32. pascal Boolean SetPrefFile(Str255 prefsFileName, OSType prefCreator,OSType prefType, short *appFile, short *prefFile, Boolean alwaysExternal);
  33. pascal OSErr CopyResource(short fromFile, short toFile, ResType theResType, short id);
  34.  
  35. /* Progress bar */
  36.  
  37. typedef Ptr ProgressBarColorPtr;
  38. typedef Ptr ProgressBarPtr;
  39.  
  40. pascal ProgressBarPtr InitProgressBar(short prefFile,short resID, Rect bounds, ProgressBarColorPtr colors);
  41. pascal ProgressBarColorPtr ProgressBarColors(short frameRed,short frameGreen,short frameBlue,short backRed,short backGreen,short backBlue,short foreRed,short foreGreen,short foreBlue);
  42. pascal ProgressBarColorPtr ProgressBarColorsRGB(RGBColor frame,RGBColor back,RGBColor fore);
  43. pascal void AdvanceProgressBar(ProgressBarPtr thePB);
  44. pascal void FinishProgressBar(ProgressBarPtr thePB);
  45.  
  46. /* Sprite record for sprites with fixed-point movement */
  47.  
  48.          typedef struct {
  49. /* Variables that you should change as appropriate */
  50.                 short kind; /* Used for identification. >0: friend. <0 foe */
  51.                 Point position;
  52.                 Rect hotRect, hotRect2; /* Tells how large the sprite is; hotRect is centered around origo */
  53.                                     /*hotRect is set by you. hotRect2 is offset to the current position.*/
  54.                 FacePtr face;            /* Pointer to the Face (appearance) to be used. */
  55.                 ProcPtr task;            /* Callback-routine, called once per frame. If task=nil, the sprite is removed. */
  56.                 ProcPtr hitTask;        /* Callback in collisions. */
  57.                 ProcPtr destructTask;    /* Called when a sprite is disposed. (Usually nil.) */
  58.                 RgnHandle clip;            /*Clip region to be used when this sprite is drawn.*/
  59. /* SAT variables that you shouldn't change: */
  60.                 Point oldpos;                /*Used by RunSAT2*/
  61.                 SpritePtr next, prev;    /*You may change them in your own sorting routine, but be careful if you do.*/
  62.                 Rect r, oldr;                /*Rectangle telling where to draw. Avoid messing with it.*/
  63.                 FacePtr oldFace;            /*Used by RunSAT2*/
  64.                 Boolean dirty;            /*Used by RunSAT2*/
  65. /*Variables for internal use by the sprites. Use as you please. Edit as necessary - this is merely a default*/
  66. /*set, enough space for most cases - but if you change the size of the record, call SetSpriteSize immediately*/
  67. /*after initializing (before any sprites are created)!*/
  68.                 short layer; /*For layer-sorting. When not used for that, use freely.*/
  69.                 Point speed; /* Can be used for speed, but not necessarily. */
  70.                 short mode; /* Usually used for different modes and/or to determine what image to show next. */
  71.                 Point fixedPointPosition; /*fixed point position*/
  72.                 long appLong; /*Longint for free use by the application.*/
  73.             } FixSprite, *FixSpritePtr;
  74.  
  75. /*Constants for separation/bounceoff between sprites*/
  76.  
  77. #define kPushBoth 0
  78. #define kPushMe 1
  79. #define kPushHim 2
  80.  
  81. /*Sprite utilities*/
  82.  
  83. pascal void MoveSprite(SpritePtr theSprite);
  84. pascal Boolean KeepOnScreen(SpritePtr theSprite);
  85. pascal void MoveSpriteFixedPoint(FixSpritePtr theSprite);
  86. pascal Boolean KeepOnScreenFixed(FixSpritePtr theSprite);
  87. pascal short RectSeparate(SpritePtr theSprite, SpritePtr anotherSprite, short push);
  88. pascal void RectBounce(SpritePtr me, SpritePtr him, short push);
  89. pascal void RectBounceFixed(FixSpritePtr me,FixSpritePtr him, short push);
  90. pascal Boolean PtInSpriteRgn(Point p, SpritePtr theSprite);
  91. pascal Boolean RegionHit(SpritePtr theSprite, SpritePtr anotherSprite);
  92. pascal void SplitVector(Point v, Point d, Point * p, Point * n);
  93. pascal void RegionBounce(FixSpritePtr s1, FixSpritePtr s2);
  94.  
  95. /**** Look-up table based fixed-point math operations. ****/
  96. /*Good for high-speed math on 68k Macs. (Not tested too much yet.)*/
  97.  
  98. /*Don't change these constants without recompiling the lib!*/
  99. #define    kFixedPointShift    4    /*Number of fixed-point positions*/
  100. #define    kFixedOne    16            /*The "one" in the fixed-point system being used!*/
  101.  
  102. pascal void InitTables();
  103. pascal long SquareRoot(long arg);
  104. pascal long Sinus(long arg);
  105. pascal long Cosinus(long arg);
  106. pascal long VectorLength(Point vector);
  107. pascal long FPVectorLength(Point vector);
  108.